<?php

include "../dao/user_dao.php";
require_once "../dao/database.php";

$class_db = new Database;
$user = new User_Dao($class_db);


$modul = $_GET['modul'];

switch($modul){

	case "pelanggan":
	
	if(isset($_POST['Submit'])){
	
		$username = $_POST['username'];
		$password = $_POST['password'];
		$reset_quest = $_POST['reset_quest'];
		$reset_answer = $_POST['reset_answer'];
		
		$value= array("$username","$password",2,"$reset_quest","$reset_answer");
		$row = 'username,password,category,reset_quest,reset_answer';
		$add=$user->db->add('user',$value,$row);
		
		if($add){
				header("location:index.php");
				//header('location:my_account.php?modul=biodata');
				//echo "lanjutkan mengisi data detail anda";
			}else{
				echo "isi semua field terlebih dahulu";
			}
			
	}
	
	break;
	
	case "toko":
	
	if(isset($_POST['Submit'])){
	
		$username = $_POST['username'];
		$password = $_POST['password'];
		$reset_quest = $_POST['reset_quest'];
		$reset_answer = $_POST['reset_answer'];
		
		$value= array("$username","$password",3,"$reset_quest","$reset_answer");
		$row = 'username,password,category,reset_quest,reset_answer';
		$add=$user->db->add('user',$value,$row);
		
		if($add){
				header("location:index.php");
				//header('location:my_account.php?modul=biodata');
				//echo "lanjutkan mengisi data detail anda";
			}else{
				echo "isi semua field terlebih dahulu";
			}
			
	}
	
	break;

}
?>